﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CCommon;

namespace JovensIPR
{
    public partial class Main : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnEnviar_Click(object sender, EventArgs e)
        {
            lblResult.Text = Common.SendEmail(tbxEmail.Text.Trim(), "comunicacaoipr@jovensipr.com.br",
                                                tbxNome.Text.Trim(), tbxMensagem.Text.Trim());

            if (!lblResult.Text.Contains("Erro"))
                lblResult.ForeColor = System.Drawing.Color.DarkGreen;
            else
                lblResult.ForeColor = System.Drawing.Color.DarkRed;

            ResetFieldEmail();
        }

        private void ResetFieldEmail()
        {
            tbxNome.Text = String.Empty;
            tbxEmail.Text = String.Empty;
            tbxMensagem.Text = String.Empty;
        }

        protected void btnCancelar_Click(object sender, EventArgs e)
        {
            lblResult.Text = String.Empty;
            ResetFieldEmail();
        }
    }
}